package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.ReturnList;
import com.atguigu.jxc.service.ReturnListGoodsService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/returnListGoods")
public class ReturnListGoodsController {

    @Autowired
    private ReturnListGoodsService returnListGoodsService;

    @RequestMapping("/save")
    @RequiresPermissions(value = "退货出库")
    public ServiceVO save (ReturnList returnList, String returnListGoodsStr){
        return returnListGoodsService.save(returnList,returnListGoodsStr);
    }

    @RequestMapping("/list")
    @RequiresPermissions(value = {"退货单据查询","供应商统计"},logical = Logical.OR)
    public Map<String,Object> list (String returnNumber,Integer supplierId,Integer state,String sTime,String eTime)
    {
        return returnListGoodsService.list(returnNumber,supplierId,state,sTime,eTime);
    }

    @RequestMapping("/goodsList")
    @RequiresPermissions(value =  {"退货单据查询","供应商统计"},logical = Logical.OR)
    public Map<String,Object> goodsList(Integer returnListId){
        return returnListGoodsService.GoodsList(returnListId);
    }

    @RequestMapping("/delete")
    @RequiresPermissions(value = "退货单据查询")
    public ServiceVO delete(Integer returnListId){
        return returnListGoodsService.delete(returnListId);
    }

    @RequestMapping("/count")
    @RequiresPermissions(value = "商品采购统计")
    public String count (String sTime,String eTime,Integer goodsTypeId,String codeOrName){
        return returnListGoodsService.count(sTime,eTime,goodsTypeId,codeOrName);
    }

}
